#!/bin/bash
projectPath=$(pwd)
scriptPath=$(cd $(dirname $0) && pwd)
projectName="${projectPath##*/}"
# scriptPath=$(cd `dirname $0`; pwd) //此方法会切换目录
templatePath=${scriptPath}/template

#初始化git信息
${scriptPath}/git.sh

# 项目文件
if test ! -d ${projectPath}/.vscode ; then
    cp -r ${templatePath}/.vscode ${projectPath}/.vscode
fi

# 忽略文件
if test ! -f ${projectPath}/.gitignore ; then
    cp ${templatePath}/.gitignore ${projectPath}/.gitignore
fi

# 编译文件
if test ! -f ${projectPath}/CMakeLists.txt ; then
    cp ${templatePath}/CMakeLists.txt ${projectPath}/CMakeLists.txt
fi

# 编译脚本
if test ! -f ${projectPath}/build_for_linux.sh ; then
    cp ${templatePath}/build_for_linux.sh ${projectPath}/build_for_linux.sh
fi

# 说明文件
if test ! -f ${projectPath}/README.md ; then
    echo "# ${projectName}" > ${projectPath}/README.md
fi

# 配置目录
if test ! -d ${projectPath}/config ; then
    mkdir -p ${projectPath}/config
fi

# 日志目录
if test ! -d ${projectPath}/logs ; then
    mkdir -p ${projectPath}/logs
    echo "*" > ${projectPath}/logs/.gitignore
    echo "!.gitignore" >> ${projectPath}/logs/.gitignore
fi

# 测试目录
if test ! -d ${projectPath}/tests ; then
    mkdir -p ${projectPath}/tests
fi

# 资源目录
if test ! -d ${projectPath}/resources ; then
    mkdir -p ${projectPath}/resources
fi

# 第三方库目录
if test ! -d ${projectPath}/libs ; then
    mkdir -p ${projectPath}/libs
fi

# 源码目录
if test ! -d ${projectPath}/src ; then
    cp -r ${templatePath}/src ${projectPath}/src
fi


